#include <stdio.h>

int gcd(int a, int b)
{
    int r;

    if (a == 0)
        return b;
    if (b == 0)
        return a;

    while ((r = a % b) != 0)
    {
        a = b;
        b = r;
    }
    return b;
}

int main()
{
    char s[10];
    while (scanf("%s", s) == 1)
    {
        /* compute a/b +/- c/d = p/q */
        int a=s[0]-'0', b=s[2]-'0', c=s[4]-'0', d=s[6]-'0';
        int p = (s[3] == '+')? a*d + b*c : a*d - b*c;
        int q = b*d;
        int g = gcd(p >= 0? p : -p, q);
        p /= g;
        q /= g;
        if (q == 1)
            printf("%d\n", p);
        else
            printf("%d/%d\n", p, q);
    }
    return 0;
}
